<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

    <title>软件学院操行管理系统</title>
    <link rel="stylesheet" type="text/css" href="../css/bootstrap-cerulean.css">
    <link href="../css/charisma-app.css" rel="stylesheet">
    <style type="text/css">
        .sidebar-nav {
            padding: 6px 0;
        }
    </style>
    <script src="http://lib.sinaapp.com/js/jquery/2.2.4/jquery-2.2.4.min.js"></script>
    <script src="../js/common/public.js"></script>
    <script src="../js/base64.js"></script>
    <script src="../js/bootstrap-typeahead.js"></script>
    <script src="../js/bootstrap-dropdown.js"></script>

    <script type="text/javascript">
        function fillZero(v) {
            if (v < 10) {
                v = '0' + v;
            }
            return v;
        }

        function testing() {
            var Week = ['星期天', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
            var d;
            d = new Date();
            w = Week[d.getDay()];
            Y = d.getFullYear();
            M = fillZero(d.getMonth() + 1);
            D = fillZero(d.getDate());
            H = fillZero(d.getHours());
            I = fillZero(d.getMinutes());
            S = fillZero(d.getSeconds());
            var showData = w + '  ' + Y + '-' + M + '-' + D + ' ' + H + ':' + I + ':' + S;
            return showData;
        }
        function showGMTDateTime() {
            $("#showtime").empty();
            $("#showtime").append(testing().toString());
            setTimeout('showGMTDateTime()', 1000);
        }
        $(document).ready(function () {
            var urlMsg  = parseUrl(window.location.search);
            $("#token").val(urlMsg.token);
            if (urlMsg.token!=null){
                var token = decode(urlMsg.token);
            }
            var html = $.ajax({
                type: "GET",
                url: "http://localhost:1068/admin/findAdmin?token="+token,
                async: false
            }).responseText;
            var result = eval('(' + html + ')');
            if (result.code!=200){
                alert(result.msg)
            }else {
                $("#adminName").html(result.data.userName);
                $("#adminId").val(result.data.id);
            }
            $('#studentInfo').attr('href','studentInfo.html?token='+urlMsg.token);
            $('#addStudent').attr('href','addStudent.html?token='+urlMsg.token);
            $('#classScore').attr('href','classList.html?token='+urlMsg.token);
            $('#addClass').attr('href','addClass.html?token='+urlMsg.token);
            $('#findStudentScoreRecord').attr('href','studentScoreRecord.html?token='+urlMsg.token);
            $('#findClassScoreRecord').attr('href','classScoreRecord.html?token='+urlMsg.token);
            $('#importData').attr('href','importData.html?token='+urlMsg.token);
            $('#exportDate').attr('href','exportData.html?token='+urlMsg.token);
            if (result.data.access == 0){
                $('#findAdmin').attr('href','noAccess.html?token='+urlMsg.token);
                $('#addAdmin').attr('href','noAccess.html?token='+urlMsg.token);
                $('#dataSafeManager').attr('href','noAccess.html?token='+urlMsg.token);
            }else {
                $('#findAdmin').attr('href','adminList.html?token='+urlMsg.token);
                $('#addAdmin').attr('href','addAdmin.html?token='+urlMsg.token);
                $('#dataSafeManager').attr('href','dataManage.html?token='+urlMsg.token);
            }

        });

        function studentInfo() {
            var token = $("#token").val();
            $('#studentInfo').trigger('click');
        }
       /* $(window).close(function(){
            var urlMsg  = parseUrl(window.location.search);
            $("#token").val(urlMsg.token);
            if (urlMsg.token!=null){
                var token = decode(urlMsg.token);
                token=token.substring(0,token.length-1);

            }
            var html = $.ajax({
                type: "POST",
                url: "http://localhost:1068/admin/token/deleteToken",
                data:{token:token},
                async: false
            }).responseText;
        });*/
        function toChangePassword() {
            var adminId = $("#adminId").val();
            var urlMsg  = parseUrl(window.location.search);
            var token = decode(urlMsg.token);
            window.location.href="changePassword.html?id="+adminId+"&token="+token;
        }
        function logout() {
            var urlMsg  = parseUrl(window.location.search);
            var token = decode(urlMsg.token);
            var html = $.ajax({
                type: "POST",
                url: "http://localhost:1068/admin/logout?token="+token,
                async: false
            }).responseText;
            var result = eval('(' + html + ')');
            if (result.code==200){
                alert(result.msg)
                window.location.href="../login.html"
            }
        }

    </script>
</head>

<body onload="showGMTDateTime();">
<input type="hidden" id="token" value=""/>
<div class="navbar">
    <div class="navbar-inner" style="background-color: #798792; padding-top:0px; padding-bottom:0px;">
        <div class="container-fluid">

            <a class="brand" style="width:250px" href="admin.action">
                <img src="../images/logo20.png"/><span>软件学院操行管理系统</span>
            </a>

            <div class="btn-group pull-right">
                <a class="btn dropdown-toggle" data-toggle="dropdown">
                    <i class="icon-user"></i><span class="hidden-phone" id="adminName"></span>
                    <span class="caret"></span>
                </a>
                <ul class="dropdown-menu">
                    <li><a href="javascript:toChangePassword()">修改密码</a></li>
                    <li class="divider"></li>
                    <li><a href="javascript:logout()">安全退出</a></li>
                    <input type="hidden" value="" id="adminId"/>
                </ul>
            </div>

            <div class="top-nav nav-collapse">
                <ul class="nav">
                    <li>
                        <form action="admin/allsearch.action" method="post" class="navbar-search pull-left"
                              target="rightFrame">
                            <input placeholder="随便输点什么吧！" class="search-query span2" name="keyword" type="text"
                                   style="background-color: #B1BDC4;">
                        </form>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</div>

<div class="container-fluid" style="padding-left:30px;padding-right:0px;">
    <div class="row-fluid">
        <div class="span2 main-menu-span" style="width:16%;">
            <div class="well nav-collapse sidebar-nav">
                <ul class="nav nav-tabs nav-stacked main-menu" style="margin-bottom:0px;">
                    <li class="nav-header hidden-tablet">学生管理</li>
                    <li><a id="studentInfo" class="ajax-link" href="" target="rightFrame"><i
                            class="icon-list-alt"></i><span class="hidden-tablet"> 学信生息操行</span></a></li>
                    <li><a id="addStudent" class="ajax-link" href="" target="rightFrame"><i
                            class="icon-user"></i><span class="hidden-tablet">添加学生信息</span></a></li>
                    <li class="nav-header hidden-tablet">班级管理</li>
                    <li><a id="classScore" class="ajax-link" href="" target="rightFrame"><i
                            class="icon-list-alt"></i><span class="hidden-tablet">班级信息量化</span></a></li>
                    <li><a id="addClass" class="ajax-link" href="" target="rightFrame"><i
                            class="icon-user"></i><span class="hidden-tablet">添加班级信息</span></a></li>
                    <li class="nav-header hidden-tablet">记录查看</li>
                    <li><a id="findStudentScoreRecord" class="ajax-link" href="" target="rightFrame"><i
                            class="icon-list-alt"></i><span class="hidden-tablet">操行修改记录</span></a></li>
                    <li><a id="findClassScoreRecord" class="ajax-link" href="" target="rightFrame"><i
                            class="icon-list-alt"></i><span class="hidden-tablet">量化修改记录</span></a></li>
                    <li class="nav-header hidden-tablet">数据管理</li>
                    <li><a id="importData" class="ajax-link" href="" target="rightFrame"><i
                            class="icon-upload"></i><span class="hidden-tablet">数据信息导入</span></a></li>
                    <li><a id="exportDate" class="ajax-link" href="" target="rightFrame"><i
                            class=" icon-download"></i><span class="hidden-tablet">数据信息导出</span></a></li>
                    <li class="nav-header hidden-tablet">系统管理</li>
                    <li><a id="findAdmin" class="ajax-link" href="" target="rightFrame"><i
                            class="icon-list-alt"></i><span class="hidden-tablet">查看管理人员</span></a></li>
                    <li><a id="addAdmin" class="ajax-link" href="" target="rightFrame"><i
                            class="icon-user"></i><span class="hidden-tablet">添加管理人员</span></a></li>
                    <li><a id="dataSafeManager" class="ajax-link" href="" target="rightFrame"><i
                            class="icon-user"></i><span class="hidden-tablet">数据安全管理</span></a></li>
                    <li class="nav-header hidden-tablet"><span id="showtime" class="hidden-tablet"></span></li>
                </ul>
            </div>
        </div>

        <div id="content" class="span10" style="height:1000px;width:81.8%;margin-left:10px;">
            <iframe height="100%" width="100%" style="border:0;" src="adminWelcome.html"
                    name="rightFrame"></iframe>
        </div>
    </div>
</div>

<div id="footer">
    <p style="padding-top:0px; text-align:center;">
        版本所有:<a href="javascript:void(0)">南阳理工软件学院</a>&nbsp;&nbsp;&nbsp;技术支持:<a href="javascript:void(0)">前研工作室</a>
    </p>
</div>

</body>
</html>
